package com.hl.card.modular.pack.controller;

import com.hl.card.common.util.CommonUtil;
import com.hl.card.common.util.ResponseData;
import com.hl.card.modular.pack.service.DisMemberInfoYService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 合伙人申请资料控制器
 * 
 * @author 袁伟
 *
 */
@RestController
@RequestMapping("/api/disMemberInfo/y")
public class DisMemberInfoYController {
	@Autowired
	private DisMemberInfoYService disMemberInfoService;
	@Autowired
	private ResponseData responseData;
	
	/**
	 * 我推荐的合伙人列表
	 * @param user_id
	 * @return
	 */
	@RequestMapping("/queryDisMemberInfoByParentId.do")
	public ResponseData queryDisMemberInfoByParentId(String user_id,Integer page,Integer size) {
		responseData.setData(null);
		if (CommonUtil.isEmpty(user_id)) {
			responseData.setStatus("0");
			responseData.setMsg("用户ID不能为空");
			return responseData;
		}
		if(page==null||"".equals(page))
		{
			page=1;
		}
		if(size==null||"".equals(size))
		{
			size=10;
		}
		Integer start=size*(page-1);
		ResponseData responseData=disMemberInfoService.queryDisMemberInfoByParentId(user_id,start,size);
		return responseData;
	}
	/**
	 * 我邀请的会员列表
	 * @param user_id
	 * @return
	 */
	@RequestMapping("/queryUserInfoByParentId.do")
	public ResponseData queryUserInfoByParentId(String user_id,Integer page,Integer size) {
		responseData.setData(null);
		if (CommonUtil.isEmpty(user_id)) {
			responseData.setStatus("0");
			responseData.setMsg("用户ID不能为空");
			return responseData;
		}
		if(page==null||"".equals(page))
		{
			page=1;
		}
		if(size==null||"".equals(size))
		{
			size=10;
		}
		Integer start=size*(page-1);
		ResponseData responseData=disMemberInfoService.queryUserInfoByParentId(user_id,start,size);
		return responseData;
	}
	
	/**
	 * 我的收益
	 * @param user_id
	 * @return
	 */
	@RequestMapping("/queryMyEarnings.do")
	public ResponseData queryMyEarnings(String user_id,Integer page,Integer size,Integer flag,String cardType) {
		responseData.setData(null);
		if (CommonUtil.isEmpty(user_id)) {
			responseData.setStatus("0");
			responseData.setMsg("用户ID不能为空");
			return responseData;
		}
		if (CommonUtil.isEmpty(cardType)) {
			responseData.setStatus("0");
			responseData.setMsg("卡种不能为空");
			return responseData;
		}
		if(page==null||"".equals(page))
		{
			page=1;
		}
		if(size==null||"".equals(size))
		{
			size=10;
		}
		Integer start=size*(page-1);
		ResponseData responseData=disMemberInfoService.queryMyEarnings(user_id,start,size,flag,cardType);
		return responseData;
	}
	
	
	/**
	 * 我的收益明细
	 * @param user_id
	 * @return
	 */
	@RequestMapping("/queryMyEarningsDetail.do")
	public ResponseData queryMyEarningsDetail(String user_id,Integer page,Integer size,Integer flag,String creatTime,String cardType) {
		responseData.setData(null);
		if (CommonUtil.isEmpty(user_id)) {
			responseData.setStatus("0");
			responseData.setMsg("用户ID不能为空");
			return responseData;
		}
		if (CommonUtil.isEmpty(cardType)) {
			responseData.setStatus("0");
			responseData.setMsg("卡种不能为空");
			return responseData;
		}
		if(page==null||"".equals(page))
		{
			page=1;
		}
		if(size==null||"".equals(size))
		{
			size=10;
		}
		Integer start=size*(page-1);
		ResponseData responseData=disMemberInfoService.queryMyEarningsDetail(user_id,start,size,flag,creatTime,cardType);
		return responseData;
	}
	
	/**
	 * 我推荐的店铺/矿机
	 * @param user_id
	 * @param type
	 * @return
	 */
	@RequestMapping("/queryMermberNum.do")
	public ResponseData  queryMermberNum(String user_id,Integer type)
	{
		responseData.setData(null);
		if (CommonUtil.isEmpty(user_id)) {
			responseData.setStatus("0");
			responseData.setMsg("用户ID不能为空");
			return responseData;
		}
		if (type==null) {
			responseData.setStatus("0");
			responseData.setMsg("标识不能为空");
			return responseData;
		}
		ResponseData responseData=disMemberInfoService.queryMermberNum(user_id,type);
		return responseData;
	}
	
	
	/**
	 * 我推荐的店铺/矿机累计
	 * @param user_id
	 * @param type
	 * @return
	 */
	@RequestMapping("/queryMermberNumTotal.do")
	public ResponseData  queryMermberNumTotal(String user_id)
	{
		responseData.setData(null);
		if (CommonUtil.isEmpty(user_id)) {
			responseData.setStatus("0");
			responseData.setMsg("用户ID不能为空");
			return responseData;
		}
		ResponseData responseData=disMemberInfoService.queryMermberNumTotal(user_id);
		return responseData;
	}
}
